#include "block.h"

Block::Block(class AbstractNode * firstArgument, class AbstractNode * secondArgument, class AbstractNode * code)
{
	c_firstArgument=firstArgument;
	c_secondArgument=secondArgument;
	c_code=code;
}

void Block::write(GraphStream * s)
{
	this->accept(s);

	fprintf(s->stream,"\tnode_%d [label=\"Block code node\" shape=\"rectangle\"]\n", this->number());
	if (c_firstArgument!=NULL){
		c_firstArgument->write(s);
		fprintf(s->stream,"\tnode_%d -> node_%d [label=\"first argument\"]\n",this->number(),c_firstArgument->number());
	}
	if (c_secondArgument!=NULL){
		c_secondArgument->write(s);
		fprintf(s->stream,"\tnode_%d -> node_%d [label=\"second argument\"]\n",this->number(),c_secondArgument->number());
	}

	c_code->write(s);
	fprintf(s->stream,"\tnode_%d -> node_%d [label=\"code\"]\n",this->number(),c_code->number());
}

Block::~Block(void)
{
}
